package ai.peanut.consumer.a.controller;

import ai.peanut.dubbo.inter.a.ATestService;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {
    //timeout 可以不指定，但是version一定要指定 不然会找不到服务 直连需要加url="dubbo://localhost:20880"
    //多个service指定cluster 会以一个为准
    //尝试次数  指定为3实际是调用4次加第一次的话
    @Reference(version = "1.0.0")//,loadbalance="roundrobin",cluster="failover", retries=3)
    private ATestService aTestService;


    @GetMapping(value="/dubbo")
    public String sayHello(){

        String result = aTestService.demo(555);
        return result;
    }
}
